package com.ruoyi.cmdb.service.impl;

import java.util.List;

import com.ruoyi.cmdb.util.GetId;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmdb.mapper.ServiceInstanceStatusMapper;
import com.ruoyi.cmdb.domain.ServiceInstanceStatus;
import com.ruoyi.cmdb.service.IServiceInstanceStatusService;

/**
 * 服务实例的状态Service业务层处理
 *
 * @author ruoyi
 * @date 2023-01-29
 */
@Service
public class ServiceInstanceStatusServiceImpl implements IServiceInstanceStatusService
{
    GetId getId=new GetId();//用这个类的方法生成当前时间的id
    @Autowired
    private ServiceInstanceStatusMapper serviceInstanceStatusMapper;

    /**
     * 查询服务实例的状态
     *
     * @param id 服务实例的状态主键
     * @return 服务实例的状态
     */
    @Override
    public ServiceInstanceStatus selectServiceInstanceStatusById(String id)
    {
        return serviceInstanceStatusMapper.selectServiceInstanceStatusById(id);
    }

    /**
     * 查询服务实例的状态列表
     *
     * @param serviceInstanceStatus 服务实例的状态
     * @return 服务实例的状态
     */
    @Override
    public List<ServiceInstanceStatus> selectServiceInstanceStatusList(ServiceInstanceStatus serviceInstanceStatus)
    {
        return serviceInstanceStatusMapper.selectServiceInstanceStatusList(serviceInstanceStatus);
    }

    /**
     * 新增服务实例的状态
     *
     * @param serviceInstanceStatus 服务实例的状态
     * @return 结果
     */
    @Override
    public int insertServiceInstanceStatus(ServiceInstanceStatus serviceInstanceStatus)
    {
        serviceInstanceStatus.setId(getId.getTimeId());
        serviceInstanceStatus.setCreateTime(DateUtils.getNowDate());
        return serviceInstanceStatusMapper.insertServiceInstanceStatus(serviceInstanceStatus);
    }

    /**
     * 修改服务实例的状态
     *
     * @param serviceInstanceStatus 服务实例的状态
     * @return 结果
     */
    @Override
    public int updateServiceInstanceStatus(ServiceInstanceStatus serviceInstanceStatus)
    {
        serviceInstanceStatus.setUpdateTime(DateUtils.getNowDate());
        return serviceInstanceStatusMapper.updateServiceInstanceStatus(serviceInstanceStatus);
    }

    /**
     * 批量删除服务实例的状态
     *
     * @param ids 需要删除的服务实例的状态主键
     * @return 结果
     */
    @Override
    public int deleteServiceInstanceStatusByIds(String[] ids)
    {
        return serviceInstanceStatusMapper.deleteServiceInstanceStatusByIds(ids);
    }

    /**
     * 删除服务实例的状态信息
     *
     * @param id 服务实例的状态主键
     * @return 结果
     */
    @Override
    public int deleteServiceInstanceStatusById(String id)
    {
        return serviceInstanceStatusMapper.deleteServiceInstanceStatusById(id);
    }
}
